package com.geoboard.service;

import java.util.ArrayList;

import android.util.Log;

import com.android.volley.Response;
import com.geoboard.entity.Post;
import com.geoboard.fragments.MapFrag;

public class GetPostsListener implements Response.Listener<ArrayList<Post>>{

	/**** Members **************************************************/
	private MapFrag mMapFrag;
	private String TAG = this.getClass().getSimpleName();
	
	//TODO thread safe?
	public GetPostsListener (MapFrag mapFrag) {
		mMapFrag = mapFrag;
	}
	
	@Override
	public void onResponse(ArrayList<Post> posts) {
		Log.d(TAG, String.format("Recieved %d posts", posts.size()));
		mMapFrag.setRetrievedPosts(posts);
		mMapFrag.displayPosts();
	}

}
